package com.stack.admin.controller.v1;


import com.stack.admin.service.AdSensitiveService;
import com.stack.admin.service.AdUserService;
import com.stack.model.admin.dtos.AdSensitiveDto;
import com.stack.model.admin.dtos.PageQueryDto;
import com.stack.model.admin.pojos.AdSensitive;
import com.stack.model.admin.pojos.AdUser;
import com.stack.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author llz
 * @date 2023/11/15 9:22
 * @description
 */
@Api(value= "敏感词设置")
@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController {

    @Resource
    private AdSensitiveService adSensitiveService;

    /**
     * export const API_SENSITIVE_LIST = '/service_6001/admin/api/v1/sensitive/list'
     * export const API_SENSITIVE_SAVE = '/service_6001/admin/api/v1/sensitive/save'
     * export const API_SENSITIVE_UPDATE = '/service_6001/admin/api/v1/sensitive/update'
     * export const API_SENSITIVE_DELETE = '/service_6001/admin/api/v1/sensitive/del/'
     */

    @ApiOperation("获取敏感词列表")
    @PostMapping("/list")
    public ResponseResult getSensitiveWordList(@RequestBody PageQueryDto pageQueryDto) {
        return adSensitiveService.getSensitiveWordList(pageQueryDto);
    }


    @ApiOperation("保存敏感词")
    @PostMapping("/save")
    public ResponseResult saveSensitiveWord(@RequestBody AdSensitiveDto dto){
        return adSensitiveService.saveSensitiveWord(dto);
    }

    @ApiOperation("修改敏感词")
    @PostMapping("/update")
    public ResponseResult updateSensitiveWord(@RequestBody AdSensitiveDto dto){
        return adSensitiveService.updateSensitiveWord(dto);
    }

    @ApiOperation("删除敏感词")
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitiveWord(@PathVariable("id") Long id){
        return adSensitiveService.deleteSensitiveWord(id);
    }

}

